package com.ourteam.frame.web;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class ProgressInfoBean implements Serializable {

	private String id;

	private long totalCount;

	private long value;

	private String task;

	private String progressMessage;

	private boolean unkownProgress;

	private String progressStyle;

	public String getProgressStyle() {
		return progressStyle;
	}

	public void setProgressStyle(String progressStyle) {
		this.progressStyle = progressStyle;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public long getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(long totalCount) {
		this.totalCount = totalCount;
	}

	public long getValue() {
		return value;
	}

	public void setValue(long value) {
		this.value = value;
	}

	public String getProgressMessage() {
		return progressMessage;
	}

	public void setProgressMessage(String progressMessage) {
		this.progressMessage = progressMessage;
	}

	public boolean isUnkownProgress() {
		return unkownProgress;
	}

	public void setUnkownProgress(boolean unkownProgress) {
		this.unkownProgress = unkownProgress;
	}

	public String getTask() {
		return task;
	}

	public void setTask(String task) {
		this.task = task;
	}

	public double getProgress() {

		if (unkownProgress) {
			return 100;
		} else {
			double profress = this.totalCount != 0 ? ((double) this.value / (double) this.totalCount) : 0;
			return BigDecimal.valueOf(profress * 100).setScale(0, RoundingMode.HALF_UP).stripTrailingZeros()
					.doubleValue();
		}
	}
}
